package 刷题10月.每日一题0930;
// https://leetcode-cn.com/problems/B1IidL/
public class 剑指Offer069山峰数组的顶部1014 {
    class Solution {
        public int peakIndexInMountainArray(int[] arr) {
            int j=0;
            for(int i=1;i<arr.length-1;i++){
                if(arr[i]>arr[i-1]){
                    if(arr[i]>arr[i+1]){
                        j=i;
                        return j;
                    }
                }
                else if(arr[i]<arr[i-1]){
                    if(arr[i]<arr[i+1]){
                        j=i;
                        return j;
                    }
                }
            }
            return -1;

        }
    }
}
